module alu_ctrl(
  input [1:0] alu_op,
  input [2:0] func3,
  input [6:0] func7,
  output reg [3:0] alu_op_ctrl
);

  always @(*) begin
    case(alu_op)
      2'b00:  alu_op_ctrl <= 4'b0010;
      2'b01:  alu_op_ctrl <= 4'b0110;
      2'b10:
        case(func3)
          3'b111:  alu_op_ctrl <= 4'b0000;
          3'b110:  alu_op_ctrl <= 4'b0001;
          3'b000:  alu_op_ctrl <= {1'b0, func7[5], 2'b10};
          default: alu_op_ctrl <= 4'b0000;
        endcase
      default: alu_op_ctrl <= 4'b0000;
    endcase
  end

endmodule